{
 "cells": [
  {
   "cell_type": "markdown",
   "id": "e281a542-e70f-4162-a450-b447b4cf8226",
   "metadata": {},
   "source": [
    "### Testing `gonbui` content reaches kernel\n",
    "\n",
    "We need to test the `gonbui` defined in the git repository being tested.\n",
    "For that we expect `GONB_GIT_ROOT` to be set."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "id": "600d1809-007c-4c00-acd7-53342bfdfdd6",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "%goflags=[\"--cover\" \"--covermode=set\"]\n",
      "GOCOVERDIR=/tmp/gonb_test_coverage.6X8w4Qlxik\n"
     ]
    }
   ],
   "source": [
    "%goflags --cover --covermode=set\n",
    "import \"os\"\n",
    "\n",
    "%%\n",
    "fmt.Printf(\"GOCOVERDIR=%s\\n\", os.Getenv(\"GOCOVERDIR\"))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "id": "60efdb28-4184-4bf2-9216-284a531e9344",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "ok\n"
     ]
    }
   ],
   "source": [
    "!if [[ \"${GONB_GIT_ROOT}\" == \"\" ]] ; then \\\n",
    "    echo \"Please set GONB_GIT_ROOT before runnig this notebook!\" 1>&2 ; \\\n",
    "else \\\n",
    "    echo \"ok\" ; \\\n",
    "fi"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "id": "d5a28f1b-18ff-4c38-b5f9-908f0863fec6",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "\t- Added replace rule for module \"github.com/janpfeifer/gonb\" to local directory \"/home/janpf/Projects/gonb\".\n"
     ]
    }
   ],
   "source": [
    "!*rm -f go.work && go work init && go work use . \"${GONB_GIT_ROOT}\"\n",
    "%goworkfix"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "id": "b0f6f952-5503-490d-a371-7f4106fd43cf",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "html displayed"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "import \"github.com/janpfeifer/gonb/gonbui\"\n",
    "\n",
    "%%\n",
    "gonbui.DisplayHTML(\"html displayed\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "id": "3df60c07-56fd-486b-8202-cb7047cbb5d3",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/markdown": [
       "markdown displayed"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "%%\n",
    "gonbui.DisplayMarkdown(\"markdown displayed\")"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Go (gonb)",
   "language": "go",
   "name": "gonb"
  },
  "language_info": {
   "codemirror_mode": "",
   "file_extension": ".go",
   "mimetype": "text/x-go",
   "name": "go",
   "nbconvert_exporter": "",
   "pygments_lexer": "",
   "version": "go1.25.3"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
